home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
clang
/
tcplusx.zip
/
EVENTMGR.H
< prev
next >
Wrap
C/C++ Source or Header
|
1991-02-24
|
5KB
|
211 lines
#ifndef _EVENTMGR_H
#define _EVENTMGR_H
//
// eventmgr.h - header file for class EventManager
// Author - Robin W. McKean
// Last Update - February 23,1991
// Copyright (C) 1991 All rights reserved
//
// This file remains the property of the author, Robin W. McKean. You are
// free to use and change it as you see fit. This module, nor its object
// code, may not however be included in any packaged software without the
// written consent of the author.
//
// Contents ----------------------------------------------------------------
//
// eventManagerClass
// EventManager
//
// Description
//
// The purpose if this class is to command and control all of the
// devices that a programmer wants to use as input. The devices will
// feed events to the event manager, and the programmer can access
// those events by calling EventManager::getEvent( Event& ). Also, the
// programmer can put their own events into the queue by calling
// EventManager::putEvent( Event&, int ).
//
// End ---------------------------------------------------------------------
// Interface dependencies --------------------------------------------------
#ifndef _OBJECT_H
#include <object.h>
#endif
#ifndef _GEN_H
#include <gen.h>
#endif
#ifndef _USETYPES_H
#include <usetypes.h>
#endif
#ifndef _IOSTREAM_H
#include <iostream.h>
#endif
// End Interface dependencies ----------------------------------------------
// Implementation dependencies ---------------------------------------------
#ifndef _DBLLIST_H
#include <dbllist.h>
#endif
#ifndef _LIST_H
#include <list.h>
#endif
#ifndef _DEQUE_H
#include <deque.h>
#endif
#ifndef _EVENT_H
#include <event.h>
#endif
// End Implementation dependencies -----------------------------------------
// Class //
class EventManager : public Object
{
public:
EventManager( int maxEvents );
~EventManager( void );
classType isA( ) const;
char *nameOf( ) const;
hashValueType hashValue( ) const;
int isEqual( const Object& ) const;
void printOn( ostream& ) const;
void putEvent( Event& theEvent, int atBeginning = FALSE );
void getEvent( Event& theEvent );
void positionDevice( classType device, int row, int column );
void showDevice( classType device );
void hideDevice( classType device );
void addDevice( Object& theDevice );
void subtractDevice( Object& theDevice );
void operator += ( Object& theDevice )
{ addDevice( theDevice ); }
void operator -= ( Object& theDevice )
{ subtractDevice( theDevice ); }
private:
Deque queueList;
DoubleList freeList;
List deviceList;
Event *events;
int eventMax;
};
// Description -------------------------------------------------------------
//
// Member Functions:
//
// Constructor
//
// The constructor sets up the queues and lists, and sets the maximum
// number of events the queue may hold.
//
// Destructor
//
// The destructor destroys the list and frees the events.
//
// isA
//
// Returns the class type eventManagerClass
//
// nameOf
//
// Returns "EventManager"
//
// hashValue
//
// This object has no hash value, so it returns 0.
//
// isEqual
//
// NO EventManager classes may be equal, so I don't think you could
// possibly need more than one of these
//
// printOn
//
// This will dump the device list, and the queue list to cout.
//
// putEvent
//
// This puts an event into the queue, depending on where the user
// requested. Set atBeginning to one if it should go in front.
//
// getEvent
//
// This will return an event if one is available in the queue, or it
// will poll the devices until one comes available
//
// positionDevice
//
// This will position a device. You pass it the class type of the
// device as listed below, and the row/column location.
//
// Cursor: cursorClass
// Mouse: mouseClass
//
//
// showDevice
//
// This will turn on a device that was previously turned off.
//
// hideDevice
//
// This will hide the device
//
// addDevice
//
// This will add a device to the event managers queue. It will be
// polled for information to place into the queue.
//
// subtractDevice
//
// This will subtract a device from the device list.
//
// operator +=
//
// The same as addDevice
//
// operator -=
//
// The same as subtractDevice
//
// Member classes or variables
//
// queueList
//
// Double ended queue that will hold our events
//
// deviceList
//
// Single list that holds all of our devices
//
// freeList
//
// Contains the events that are free to be added to the queue
//
// events
//
// The pointer to the events created by the constructor
//
// eventMax
//
// The number of events in the free list
//
// End Summary -------------------------------------------------------------
#endif // _EVENTMGR_H //